<template>
      <div id="vipmanger">
            <page-title><span slot="pageName">{{ username }}</span></page-title>
                <!-- <div class="box">
                        <el-button class="uploadGoods" type="primary" round @click="getAllManger('memzong', 1)">全部</el-button>
                       
                        <el-button class="uploadGoods" type="success" round @click="getAllManger('mempt', 1)">普通会员</el-button>
                        <el-button class="uploadGoods" type="info" round @click="getAllManger('memjgg', 1)">技工</el-button>
                        <el-button class="uploadGoods" type="warning" round @click="getAllManger('memjgs', 1)">企业</el-button>
                        <el-button class="uploadGoods"  round @click="getAllManger('memck', 1)">创客</el-button>
                        <el-button class="uploadGoods"  round type="primary" @click="addMaster()">添加创客</el-button>
                  </div> -->

            <!-- 表格 -->
              <el-table
                  :data="tableData"
                  style="width: 100%"
                  border
                  :height="height"
                  stripe
                  align="center"
                  :row-class-name="tableRowClassName">
                        <el-table-column
                              prop="userid"
                              align="center"
                              label="会员ID"
                              >
                        </el-table-column>
                        <el-table-column
                              prop="headimgurl"
                              align="center"
                              label="会员头像"
                              width="100px"
                              >
                              <template slot-scope="scope">
                                   <div class="imgbox">
                                         <img class="avatar" :src="scope.row.headimgurl" alt="" width="28" height="28" >
                                   </div>
                              </template>
                        </el-table-column>
                        <el-table-column
                              prop="wnickname"
                              align="center"
                              label="会员昵称">
                        </el-table-column>
                        <el-table-column
                              prop="addtime"
                              align="center"
                              label="注册时间">
                        </el-table-column>
                        <el-table-column
                              prop="phone"
                              align="center"
                              label="联系电话">
                        </el-table-column>

                        <el-table-column prop="cardNum" align="center" label="操作" width="300px">
                              <template slot-scope="scope">
                                   
                                    <el-button
                                    size="mini"
                                    type="danger"
                                    @click="userEdit(scope.row)">修改</el-button>
                                    
                              </template>
                        </el-table-column>
                  </el-table>
                  <!-- 分页 -->
                  <div class="page">
                        <el-pagination
                        background
                        layout="prev, pager, next"
                        :page-size="pageSize"
                        :current-page="currentPage"
                        @current-change="pageChange"
                        :total="total">
                        </el-pagination>
                  </div>
            <!-- 编辑用户信息 -->
            <!-- <edit-info :DialogData="DialogData" :FormData="FormData" :disabled="disabled" @update="getAllManger"></edit-info> -->
            <!-- 主动添加创客 -->
            <!-- <add-master :addData="addData" :FormData="FormData" @update="getAllManger"></add-master> -->
            
      </div>
</template>

<script>
      import PageTitle from '@/components/PageTitle'
      // import EditInfo from "@/components/main/EditInfo"
      // import AddMaster from "@/components/dialog/AddMaster"
      export default {
            data() {
                  return {
                        tableData: [
                              
                        ],
                        pageSize: 10,
                        currentPage: 1,
                        total: 0,
                        DialogData: {
                              show: false,
                        },
                        addData: {
                              show: false,
                              title: "添加创客"
                        },
                        FormData: {},
                        disabled: {
                              username: true,
                              phone: true,
                              password: true,
                              shopname: true,
                              shopsite: true,
                              shoptime: true,
                        },
                        PostUrl: "memzong",
                        username: ""
                  }
            },
            components: {
                  PageTitle,
                  // EditInfo,
                  // AddMaster
            },
            computed: {
                  token() {
                        return localStorage.miniToken 
                  },
                  height() {
                       return this.$store.state.height
                  },
            },
            mounted () {
                  this.getAllManger( 1);
                  
            },
            methods: {
                 
                  // 编辑店长资料
                  userEdit( row ) {
                       // console.log(row);
                        
                        this.DialogData = {
                              show: true
                        }
                        this.FormData = {
                              userid: row.userid,
                              username: row.username,
                              password: row.password,
                              phone: row.phone,
                              shopsite: row.shopsite,
                              shopname: row.shopname,
                              shoptime: row.shoptime
                        }
                        this.disabled = {
                              username: true,
                              phone: true,
                              password: true,
                              shopname: true,
                              shopsite: true,
                              shoptime: true,
                        }
                  },
                  tableRowClassName({row, rowIndex}) {
                        if (rowIndex === 1) {
                              return 'warning-row';
                        } else if (rowIndex === 3) {
                              return 'success-row';
                        }
                              return '';
                  },
                  // 获取用户的资金明细
                  async getAllManger(  pages ) {
                       let signboard = this.$route.params.userid
                       console.log(signboard, this.token);
                       let page = pages ? pages : "1"
                        let res = await this.$axios.post(`/admin/user/moneyinfo`, { token: this.token,  signboard, page })
                        console.log(res);
                        
                        
                  },
                 
                 
                  // 页码变化
                  pageChange(e) {
                        console.log(e);
                        this.getAllManger( e)
                  }
            },
      }
</script>

<style lang="scss" scoped>
  .el-table .warning-row {
    background: oldlace;
  }

  .el-table .success-row {
    background: #f0f9eb;
  }
  .box {
  width: 100%;
  text-align: left;
  padding-bottom: 30px;
}
 .page {
       padding: 20px;
       text-align: right;
 }
 .imgbox {
       text-align: center;
       width: 100%;
       display: flex;
       justify-content: center;
       .avatar {
            display: block;
            text-align: center;
            width: 28px;
            height: 28px;
            margin: 0;
            padding: 0;
      }
 }
</style>